package com.cherrish.demo.protocol.http;

import com.cherrish.demo.framework.Invocation;
import com.cherrish.demo.framework.Protocol;
import com.cherrish.demo.framework.URL;

/**
 * @author cherrish
 * @time 2019-03-20 17:39
 * @name HttpProtocol
 * @desc:
 */
public class HttpProtocol implements Protocol {
    @Override
    public void start(URL url) {
        HttpServer httpServer = new HttpServer();
        httpServer.start(url.getHostname(), url.getPort());
    }

    @Override
    public String send(URL url, Invocation invocation) {
        HttpClient httpClient = new HttpClient();
        return httpClient.post(url.getHostname(), url.getPort(), invocation);
    }
}
